package com.cjm.one.custom.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.cjm.one.custom.mapper.CustomerBalanceRecordMapper;
import com.cjm.one.custom.service.CustomerBalanceRecordService;
import com.cjm.one.model.custom.entity.CustomerBalanceRecord;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

/**
* @author 29289
* @description 针对表【customer_balance_record(用户余额流水表)】的数据库操作Service实现
* @createDate 2025-04-15 21:23:49
*/
@Service
public class CustomerBalanceRecordServiceImpl extends ServiceImpl<CustomerBalanceRecordMapper, CustomerBalanceRecord>
    implements CustomerBalanceRecordService {
    @Resource
    private CustomerBalanceRecordMapper customerBalanceRecordMapper;
    @Override
    public Page<CustomerBalanceRecord> pageList(Integer current, Integer size, Long id) {
        Page<CustomerBalanceRecord> page = new Page<>(current, size);
        LambdaQueryWrapper<CustomerBalanceRecord> customerBalanceRecordLambdaQueryWrapper = new LambdaQueryWrapper<>();
        customerBalanceRecordLambdaQueryWrapper.eq(CustomerBalanceRecord::getCustomerId, id);
        customerBalanceRecordLambdaQueryWrapper.orderByDesc(CustomerBalanceRecord::getCreateTime);
        Page<CustomerBalanceRecord> customerBalanceRecordPage = customerBalanceRecordMapper.selectPage(page, customerBalanceRecordLambdaQueryWrapper);
        return customerBalanceRecordPage;
    }
}